home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
-
- #----------------------------------------------------------------------
- # variables you should change:
-
- $finger_server = "epx.cis.umn.edu";
- $finger_port = 79;
-
- #----------------------------------------------------------------------
-
- sub finger_main {
- local($_) = @_;
-
- if (/^$/) {
- &Greply("1List of all users on $finger_server\t\t$finger_server\t$finger_port");
- &Greply("7Query finger server $finger_server\t$Ggw $finger_server\t$Ghost\t$Gport");
- &Greply(".");
- exit(0);
- }
-
- ($finger_server, $query) = split('\t');
-
- &GopenServer($finger_server,$finger_port);
- &Gsend($query);
-
- while(<GSERVER>) {
- s/\n//;
- s/\r//;
- push(@lines,$_);
- }
-
- #
- # Always return the output of the finger search first
- #
-
- &Greply("0Raw search results\t$query\t$finger_server\t$finger_port");
-
- #
- # Parse out various finger formats
- #
-
- # Unix style finger format, and gnu finger
-
- if ($lines[0] =~ /Login\s+Name/ || $lindes[0] =~ /User\s+Real/) {
-
- foreach (@lines) {
- if (!/^Login\s+Name/) {
- /^([\S]+)/;
- substr($_, 75) = "";
- &Greply("0$_\t$1\t$finger_server\t$finger_port");
- } else {
- &Greply("0$_\tnothing\tbogus\t0");
- }
- }
- }
-
- #
- # VMS finger format
- #
-
- if ($lines[1] =~ /Jobs\s+Load ave/) {
- foreach (@lines) {
- if (/^ User\s+Personal Name/ || /\d\d:\d\d:\d\d$/ ||
- /Jobs\s+Load ave/) {
- &Greply("0$_\tnothing\tbogus\t0");
- } else {
- /^([\S]+)/;
- substr($_, 75) = "";
- &Greply("0$_\t$1\t$finger_server\t$finger_port");
- }
- }
- }
-
- #
- # CSO gateway finger type servers
- #
-
- foreach (@lines) {
- if (/\s+name:\s+(.*)/ ||
- /\s+person:\s+(.*)/) {
- $newquery = $1;
- $newquery =~ s/,//g; #remove commas
- $newquery =~ s/\s+[A-z]$//; #remove trailing middle initial
- &Greply("0$1\t$newquery\t$finger_server\t$finger_port");
- }
- }
-
-
-
- &Greply(".");
- exit(0);
- }
-
-
-
-
- 1; # for require
-